package health.lm.com.mine.present;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;

import java.util.ArrayList;
import java.util.List;

import health.lm.com.component_base.base.mvp.contract.XPresent;
import health.lm.com.mine.activity.IntegralRankingListActivity;
import health.lm.com.mine.entity.IntegralRankingListEntity;
import health.lm.com.mine.model.MineModel;
import health.lm.com.network.callback.SimpleCallBack;
import health.lm.com.network.exception.ApiException;

/**
 * 积分排行榜
 * @author Administrator
 */
public class IntegralRankingListPresenter extends XPresent<IntegralRankingListActivity> {
    public void getListMore(boolean isRefresh, Object layout,int page, int pageSize) {
        MineModel.getInstance().rankingList(page, pageSize, new SimpleCallBack<IntegralRankingListEntity>() {
            @Override
            public void onSuccess(IntegralRankingListEntity entity) {

                if (hasV()) {
                    getV().getListSuccess(entity);
                }
                if (isRefresh) {
                    ((SmartRefreshLayout)layout).finishRefresh(true);
                }
            }

            @Override
            public void onError(ApiException e) {
                super.onError(e);
                if (isRefresh) {
                    ((SmartRefreshLayout)layout).finishRefresh(true);
                }
            }
        });
    }

}
